package com.heima.wemedia.feign;

import com.heima.apis.wemedia.ISwemediaSensitiveClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.NewsAuthDto;
import com.heima.model.wemedia.dtos.SensitiveDto;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.WmNewsService;
import com.heima.wemedia.service.WmSensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

@RestController
public class CheckArticleSensitive implements ISwemediaSensitiveClient {

    @Autowired
    private WmSensitiveService wmSensitiveService;
    @DeleteMapping("/api/v1/sensitive/del/{id}")
    @Override
    public ResponseResult deleteSensitive(@PathVariable("id") Integer id) {
        return wmSensitiveService.deleteSensitive(id);
    }
    @PostMapping("/api/v1/sensitive/list")
    @Override
    public ResponseResult getList(@RequestBody SensitiveDto dto) {
        return wmSensitiveService.getList(dto);
    }
    @PostMapping("/api/v1/sensitive/save")
    @Override
    public ResponseResult getSave(@RequestBody WmSensitive wmSensitive) {
        return wmSensitiveService.getSave(wmSensitive);
    }
    @PostMapping("/api/v1/sensitive/update")
    @Override
    public ResponseResult getUpdate(@RequestBody WmSensitive wmSensitive) {
        return wmSensitiveService.getUpdate(wmSensitive);
    }

    @Autowired
    private WmNewsService wmNewsService;

    @Override
    @PostMapping("/api/v1/news/list_vo")
    public ResponseResult listVo(@RequestBody NewsAuthDto dto) {
        return wmNewsService.listVo(dto);
    }

    @Override
    @GetMapping("/api/v1/news/one_vo/{id}")
    public ResponseResult oneVo(@PathVariable("id") Integer id) {
        return wmNewsService.oneVo(id);
    }

    @Override
    //审核文章之审核失败
    @PostMapping("/api/v1/news/auth_fail")
    public ResponseResult authFail(@RequestBody NewsAuthDto dto) {
        return wmNewsService.authFail(dto);
    }

    @Override
    //审核文章之审核成功
    @PostMapping("/api/v1/news/auth_pass")
    public ResponseResult authPass(@RequestBody NewsAuthDto dto) {
        return wmNewsService.authPass(dto);
    }
}
